<!DOCTYPE html>
<html>
<body>
<form method="GET" action="get-file-upload.html" enctype="application/x-www-form-urlencoded">
  <input type="file" name="file" id="file">
  <input type="file" name="nofile">
  <input type="hidden" name="submitted" value="true">
</form>
<pre id='console'></pre>

<script>
function log(message)
{
    document.getElementById('console').appendChild(document.createTextNode(message + "\n"));
}

function startOrVerify()
{
    var query = window.location.search;
    if (query.indexOf('submitted=true') != -1) {
        // Verify the result
        if (query.indexOf('file=get-file-upload.html&') == -1)
            log('FAIL: No file=get-file-upload.html; ' + query);
        else if (query.indexOf('nofile=&') == -1)
            log('FAIL: No nofile=; ' + query);
        else
            log('PASS: ' + query);
        testRunner.notifyDone();
    } else {
        // Start the test
        eventSender.beginDragWithFiles(['get-file-upload.html']);
        eventSender.mouseMoveTo(10, 10);
        eventSender.mouseUp();
        document.forms[0].submit();
    }
}

if (window.eventSender) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
    window.onload = startOrVerify;
}
</script>
</body>
</html>
